/*
 * Electronics.hpp
 *
 * Copyright 2012 Pieter Agten
 *
 * This file is part of tltgen.
 *
 * tltgen is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * tltgen is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with tltgen.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * @file   Electronics.hpp
 * @author Pieter Agten (pieter.agten@gmail.com)
 * @date   29 feb 2012
 */

#ifndef ELECTRONICS_HPP
#define ELECTRONICS_HPP

#include "Resistance.hpp"
#include "Temperature.hpp"
#include "AdcValue.hpp"

namespace tltgen {

  class Thermistor;
  class Circuit;
  class AnalogToDigitalConverter;

  /**
   * An Electronics consists of a thermistor, connected to a circuit
   * producing a temperature-dependent voltage, which is fed into an analog to 
   * digital converter.
   */
  class Electronics {
  public:
    /**
     * Constructs a new electronics model with a given thermistor, circuit and 
     * ADC.
     *
     * @param thermistor the thermistor to use in the new electronics model
     * @param circuit the circuit model to use for the new electronics model
     * @param adc the ADC model to use for the new electronics model
     */
    Electronics(const Thermistor *thermistor, const Circuit* circuit, const AnalogToDigitalConverter* adc);
    virtual ~Electronics();

    /**
     * Returns the thermistor used in these electronics.
     *
     * @return the thermistor used in these electronics
     */
    virtual const Thermistor* getThermistor(void) const;

    /**
     * Returns the circuit used in these electronics.
     *
     * @return the circuit used in these electronics
     */
    virtual const Circuit* getCircuit(void) const;

    /**
     * Returns the ADC used in these electronics.
     *
     * @return the ADC used in these electronics
     */
    virtual const AnalogToDigitalConverter* getAnalogToDigitalConverter(void) const;


    virtual Temperature getTemperature(AdcValue adcValue) const;


    virtual int getAdcOutputValue(Temperature t) const;


  private:
    const Thermistor* const thermistor;
    const Circuit* const circuit;
    const AnalogToDigitalConverter* const adc;
  };

}

#endif
